home *** CD-ROM | disk | FTP | other *** search
- /*********************************************/
- /* */
- /* Designer (C) Ian OConnor 1994 */
- /* */
- /* Designer Produced C include file */
- /* */
- /*********************************************/
-
- #include <exec/types.h>
- #include <exec/memory.h>
- #include <dos/dosextens.h>
- #include <intuition/screens.h>
- #include <intuition/intuition.h>
- #include <intuition/gadgetclass.h>
- #include <libraries/gadtools.h>
- #include <diskfont/diskfont.h>
- #include <utility/utility.h>
- #include <graphics/gfxbase.h>
- #include <workbench/workbench.h>
- #include <graphics/scale.h>
- #include <clib/exec_protos.h>
- #include <clib/wb_protos.h>
- #include <clib/intuition_protos.h>
- #include <clib/gadtools_protos.h>
- #include <clib/graphics_protos.h>
- #include <clib/utility_protos.h>
- #include <string.h>
- #include <clib/diskfont_protos.h>
-
- #include "windows.h"
-
-
- struct Window *mainwin = NULL;
- APTR mainwinVisualInfo;
- APTR mainwinDrawInfo;
- struct Gadget *mainwinGList;
- struct Gadget *mainwinGadgets[9];
- UBYTE mainwinFirstRun = 0;
-
- ULONG mainwinGadgetTags[] =
- {
- (GTLV_Selected), 0,
- (TAG_END),
- (GA_Disabled), TRUE,
- (TAG_END),
- (GA_Disabled), TRUE,
- (TAG_END),
- (GA_Disabled), TRUE,
- (TAG_END),
- (GA_Disabled), TRUE,
- (TAG_END),
- (GA_Disabled), TRUE,
- (TAG_END),
- (GTTX_Border), TRUE,
- (TAG_END),
- };
-
- UWORD mainwinGadgetTypes[] =
- {
- LISTVIEW_KIND,
- BUTTON_KIND,
- BUTTON_KIND,
- BUTTON_KIND,
- BUTTON_KIND,
- BUTTON_KIND,
- BUTTON_KIND,
- TEXT_KIND,
- BUTTON_KIND,
- };
-
- struct NewGadget mainwinNewGadgets[] =
- {
- 2, 2, 230, 100, NULL, NULL, mainwin_listview, 1, NULL, (APTR)&mainwinGadgetTags[0],
- 235, 72, 120, 14, (UBYTE *)"Get binary...", NULL, mainwin_getbinary, 16, NULL, (APTR)&mainwinGadgetTags[3],
- 235, 88, 120, 14, (UBYTE *)"Put binary...", NULL, mainwin_putbinary, 16, NULL, (APTR)&mainwinGadgetTags[6],
- 2, 104, 70, 14, (UBYTE *)"All", NULL, mainwin_all, 16, NULL, (APTR)&mainwinGadgetTags[9],
- 82, 104, 70, 14, (UBYTE *)"None", NULL, mainwin_none, 16, NULL, (APTR)&mainwinGadgetTags[12],
- 162, 104, 70, 14, (UBYTE *)"Parent", NULL, mainwin_parent, 16, NULL, (APTR)&mainwinGadgetTags[15],
- 235, 2, 120, 14, (UBYTE *)"About...", NULL, mainwin_about, 16, NULL, NULL,
- 2, 120, 353, 14, NULL, NULL, mainwin_status, 1, NULL, (APTR)&mainwinGadgetTags[18],
- 235, 104, 120, 14, (UBYTE *)"Devices", NULL, mainwin_devices, 16, NULL, NULL,
- };
-
- void RendWindowmainwin( struct Window *Win, void *vi )
- {
- UWORD offx = Win->BorderLeft;
- UWORD offy = Win->BorderTop;
- ULONG scalex = 65535*Win->WScreen->RastPort.Font->tf_XSize/8;
- ULONG scaley = 65535*Win->WScreen->RastPort.Font->tf_YSize/8;
- if (Win != NULL)
- {
- }
- }
-
- int OpenWindowmainwin( void )
- {
- struct Screen *Scr;
- UWORD offx, offy;
- UWORD loop;
- struct NewGadget newgad;
- struct Gadget *Gad;
- struct Gadget *Gad2;
- APTR Cla;
- ULONG scalex,scaley;
- if (mainwinFirstRun == 0)
- {
- mainwinFirstRun = 1;
- }
- if (mainwin == NULL)
- {
- Scr = LockPubScreen(NULL);
- if (NULL != Scr)
- {
- offx = Scr->WBorLeft;
- offy = Scr->WBorTop + Scr->Font->ta_YSize+1;
- scalex = 65535*Scr->RastPort.Font->tf_XSize/8;
- scaley = 65535*Scr->RastPort.Font->tf_YSize/8;
- if (NULL != ( mainwinVisualInfo = GetVisualInfoA( Scr, NULL)))
- {
- if (NULL != ( mainwinDrawInfo = GetScreenDrawInfo( Scr)))
- {
- mainwinGList = NULL;
- Gad = CreateContext( &mainwinGList);
- for ( loop=0 ; loop<9 ; loop++ )
- if (mainwinGadgetTypes[loop] != 198)
- {
- CopyMem((char * )&mainwinNewGadgets[loop], ( char * )&newgad, (long)sizeof( struct NewGadget ));
- newgad.ng_VisualInfo = mainwinVisualInfo;
- newgad.ng_LeftEdge = newgad.ng_LeftEdge*scalex/65535;
- newgad.ng_TopEdge = newgad.ng_TopEdge*scaley/65535;
- if (mainwinGadgetTypes[loop] != GENERIC_KIND)
- {
- newgad.ng_Width = newgad.ng_Width*scalex/65535;
- newgad.ng_Height = newgad.ng_Height*scaley/65535;
- };
- newgad.ng_TextAttr = Scr->Font;
- newgad.ng_LeftEdge += offx;
- newgad.ng_TopEdge += offy;
- mainwinGadgets[ loop ] = NULL;
- mainwinGadgets[ newgad.ng_GadgetID - mainwinFirstID ] = Gad = CreateGadgetA( mainwinGadgetTypes[loop], Gad, &newgad, newgad.ng_UserData );
- }
- for ( loop=0 ; loop<9 ; loop++ )
- if (mainwinGadgetTypes[loop] == 198)
- {
- mainwinGadgets[ loop ] = NULL;
- Cla = NULL;
- if (Gad)
- mainwinGadgets[ loop ] = Gad2 = (struct Gadget *) NewObjectA( (struct IClass *)Cla, mainwinNewGadgets[ loop ].ng_GadgetText, mainwinNewGadgets[ loop ].ng_UserData );
- }
- if (Gad != NULL)
- {
- if (NULL != (mainwin = OpenWindowTags( NULL, (WA_Left), 136,
- (WA_Top), 37,
- (WA_Width), 362*scalex/65535+offx,
- (WA_Height), 137*scaley/65535+offy,
- (WA_Title), "LinkZ88 ©1995 Andy Dean",
- (WA_ScreenTitle), "LinkZ88 ©1995 Andy Dean",
- (WA_MinWidth), 150,
- (WA_MinHeight), 25,
- (WA_MaxWidth), 1200,
- (WA_MaxHeight), 1200,
- (WA_DragBar), TRUE,
- (WA_DepthGadget), TRUE,
- (WA_CloseGadget), TRUE,
- (WA_Activate), TRUE,
- (WA_Dummy+0x30), TRUE,
- (WA_SmartRefresh), TRUE,
- (WA_AutoAdjust), TRUE,
- (WA_Gadgets), mainwinGList,
- (WA_IDCMP),4194940,
- (TAG_END))))
- {
- RendWindowmainwin(mainwin, mainwinVisualInfo );
- GT_RefreshWindow( mainwin, NULL);
- RefreshGList( mainwinGList, mainwin, NULL, ~0);
- UnlockPubScreen( NULL, Scr);
- return( 0L );
- }
- }
- FreeGadgets( mainwinGList);
- FreeScreenDrawInfo( Scr, mainwinDrawInfo );
- }
- FreeVisualInfo( mainwinVisualInfo );
- }
- UnlockPubScreen( NULL, Scr);
- }
- }
- else
- {
- WindowToFront(mainwin);
- ActivateWindow(mainwin);
- return( 0L );
- }
- return( 1L );
- }
-
- void CloseWindowmainwin( void )
- {
- if (mainwin != NULL)
- {
- FreeScreenDrawInfo( mainwin->WScreen, mainwinDrawInfo );
- mainwinDrawInfo = NULL;
- CloseWindow( mainwin);
- mainwin = NULL;
- FreeVisualInfo( mainwinVisualInfo);
- FreeGadgets( mainwinGList);
- }
- }
-
-